package com.fkdx.webman.result;

import lombok.Data;
import com.fkdx.common.enums.sys.ErrCodeEnum;
@Data
public class Result<T> {

  private int code;
  private String message;
  private String fieldName;
  private String fieldValue;
  private String fieldMessage;
  private T data;

  public Result() {
  }

  public Result(ErrCodeEnum codeEnum) {
    this.code = codeEnum.getErrCode();
    this.message = codeEnum.getErrMsg();
  }

  public Result(ErrCodeEnum codeEnum, T data) {
    this.code = codeEnum.getErrCode();
    this.message = codeEnum.getErrMsg();
    this.data = data;
  }

  public Result(ErrCodeEnum codeEnum, String fieldName, String fieldValue, String fieldMessage) {
    this.code = codeEnum.getErrCode();
    this.message = codeEnum.getErrMsg();
    this.fieldName = fieldName;
    this.fieldValue = fieldValue;
    this.fieldMessage = fieldMessage;
  }

  public Result(int code, String message) {
    this.code = code;
    this.message = message;
  }

  public Result(int code, String message, T data) {
    this.code = code;
    this.message = message;
    this.data = data;
  }

  public Result(int code, String message, String fieldName, String fieldValue, String fieldMessage) {
    this.code = code;
    this.message = message;
    this.fieldName = fieldName;
    this.fieldValue = fieldValue;
    this.fieldMessage = fieldMessage;
  }
}
